<template>
 <Layout>
    <div style="min-height: 600px">
      <el-card shadow="never" style="min-height: 400px" v-if="$page.gists.edges[0].node.id">
        <div slot="header">
          <span>{{ $page.gists.edges[0].node.title }}</span>
        </div>
        <div style="font-size: 0.9rem; line-height: 1.5; color: #606c71">
          发布 {{ $page.gists.edges[0].node.createTime }} <br />
          更新 {{ $page.gists.edges[0].node.updateTime }}
        </div>
        <div
          style="
            font-size: 1.1rem;
            line-height: 1.5;
            color: #303133;
            border-bottom: 1px solid #e4e7ed;
            padding: 5px 0px 5px 0px;
          "
        >
          <pre style="font-family: '微软雅黑'">{{ $page.gists.edges[0].node.description }}</pre>
        </div>
        <div
          v-html="content"
          class="markdown-body"
          style="padding-top: 20px"
        ></div>
      </el-card>
      <el-card
        shadow="never"
        style="
          margin-bottom: 20px;
          padding: 20px 0px 20px 0px;
          text-align: center;
        "
        v-if="!$page.gists.edges[0].node.id"
      >
        <font style="font-size: 30px; color: #dddddd">
          <b>没有更新 ╮(๑•́ ₃•̀๑)╭</b>
        </font>
      </el-card>
    </div>
  </Layout>
</template>

<page-query>
query{
  gists: allGist(sortBy: "title", order: DESC) {
    edges {
      node {
        id
        title
        content
        description
        createTime
        updateTime
      }
    }
  }
}
</page-query>

<script>
export default {
  data() {
    console.log(this.$pages)
    return {
      loading: false,
      content: '',
      blog: {
        id: "",
        title: "",
        content: "",
        description: "",
        createTime: "",
        updateTime: "",
      },
    };
  },
  mounted() {
    let mavonEditor =require('mavon-editor')
    this.content = mavonEditor.markdownIt.render(this.$page.gists.edges[0].node.content)
  }
};
</script>
